/* GUI CONVERTED from rppqmt.p (converter v1.75) Tue Aug 22 11:49:17 2000 */
/* rppqmt.p - PRODUCT LINE RESOURCE REQUIREMENT MAINTENANCE             */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                 */
/* All rights reserved worldwide.  This is an unpublished work.        */
/*F0PN*/ /*V8:ConvertMode=Maintenance                                   */
/*K1Q4*/ /*V8:RunMode=Character,Windows                                 */
/* REVISION: 1.0     LAST MODIFIED: 04/22/86    BY: EMB                 */
/* REVISION: 2.0     LAST MODIFIED: 03/12/87    BY: EMB *A41*           */
/* REVISION: 7.3     LAST MODIFIED: 07/28/92    BY: ram *F814*          */
/* REVISION: 7.3     LAST MODIFIED: 08/15/94    BY: pxd *GL29*          */
/* REVISION: 7.5     LAST MODIFIED: 10/24/94    BY: mwd *J034*          */
/* REVISION: 8.5  LAST MODIFIED: 03/05/97   BY: *G2LB* Jack Rief        */
/* REVISION: 8.6E     LAST MODIFIED: 02/23/98   BY: *L007* A. Rahane */
/* REVISION: 8.6E     LAST MODIFIED: 05/20/98   BY: *K1Q4* Alfred Tan   */
/* REVISION: 8.6E     LAST MODIFIED: 10/04/98   BY: *J314* Alfred Tan   */
/* REVISION: 9.1      LAST MODIFIED: 03/24/00 BY: *N08T* Annasaheb Rahane */
/* REVISION: 9.1      LAST MODIFIED: 08/10/00   BY: *N0K5* Arul Victoria   */
/************************************************************************/

/*J034*  * MOVED MFDTITLE.I TO TOP OF PROGRAM */
     /* DISPLAY TITLE */
         {mfdtitle.i "b+ "}

/* ********** Begin Translatable Strings Definitions ********* */

&SCOPED-DEFINE rppqmt_p_1 "Lead Time (Months)"
/* MaxLen: Comment: */

/* ********** End Translatable Strings Definitions ********* */

/*N0K5* ------------------- BEGIN DELETE ----------------------- *
 *
 * &SCOPED-DEFINE rppqmt_p_2 "ERROR: RESOURCE MUST EXIST.  Please re-enter."
 * /* MaxLen: Comment: */
 *
 *N0K5* ------------------- END   DELETE ----------------------- */

     define variable start like pq_start.
     define variable desc1 like pl_desc.
     define variable rsdesc like rs_desc.
     define variable del-yn like mfc_logical.

     /* DISPLAY SELECTION FORM */
/*GL29*/ /* added label to pq_lead */
     
/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 
        
 RECT-FRAME       AT ROW 1 COLUMN 1.25
 RECT-FRAME-LABEL AT ROW 1 COLUMN 3 NO-LABEL VIEW-AS TEXT SIZE-PIXELS 1 BY 1
 SKIP(.1)  /*GUI*/
pq_prod_line   colon 25 space(5)
        desc1          no-label
        pq_site        colon 25
        pq_rsc         colon 25
        rsdesc         no-label
        pq_start       colon 25
        pq_end         colon 25 skip(1)
        pq_qty         colon 25
        pq_lead        colon 25 label {&rppqmt_p_1}
        pq_lt_off      colon 25
      SKIP(.4)  /*GUI*/
with frame a side-labels width 80 NO-BOX THREE-D /*GUI*/.

 DEFINE VARIABLE F-a-title AS CHARACTER INITIAL "".
 RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
 RECT-FRAME-LABEL:HIDDEN in frame a = yes.
 RECT-FRAME:HEIGHT-PIXELS in frame a =
  FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.
 RECT-FRAME:WIDTH-CHARS IN FRAME a = FRAME a:WIDTH-CHARS - .5.  /*GUI*/

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME



     /* SET EXTERNAL LABELS */
     setFrameLabels(frame a:handle).

     /* DISPLAY */
     view frame a.
     repeat with frame a:
/*GUI*/ if global-beam-me-up then undo, leave.


        prompt-for
           pq_prod_line
           pq_site
           pq_rsc

/*N0K5* ------------------- BEGIN DELETE ----------------------- *
 * /*F814      ***   REMOVE THIS validate AFTER CORRECTING DB IN 7.3   *** */
 * /*F814*/          validate(can-find(rs_mstr where rs_site = input pq_site
 * /*F814*/          and rs_rsc = pq_rsc),
 * /*F814*/          {&rppqmt_p_2})
 *N0K5* ------------------- END   DELETE ----------------------- */
           pq_start
        editing:

           /* FIND NEXT/PREVIOUS RECORD */
           {mfnp.i
          pq_mstr
          pq_prod_line
          pq_prod_line
          pq_rsc
          pq_rsc
          pq_mstr
           }

           if recno <> ? then do:
          desc1 = "".
          find pl_mstr where pl_prod_line = pq_prod_line
          no-lock no-error.
          if available pl_mstr then desc1 = pl_desc.
          rsdesc = "".
          find rs_mstr where rs_rsc = pq_rsc
          and rs_site = pq_site
          no-lock no-error.
          if available rs_mstr then rsdesc = rs_desc.
          display pq_prod_line desc1 pq_site pq_rsc rsdesc
          pq_start pq_end pq_qty pq_lead pq_lt_off.
           end.
        end. /* PROMPT-FOR...EDITING */

/*N0K5* ------------------- BEGIN ADD ----------------------- */
          if frame-field = "pq_rsc" then
          do:
             if not can-find(rs_mstr where rs_site = pq_site
                             and rs_rsc = pq_rsc) then
             do:
                {mfmsg.i 3591 3}   /* RESOURCE MUST EXIST */
                next-prompt pq_rsc with frame a.
                undo, retry.
             end.

          end.
/*N0K5* ------------------- END   ADD ----------------------- */


/*J034*/    {gprun.i ""gpsiver.p""
           "(input (input pq_site), input ?, output return_int)"}
/*GUI*/ if global-beam-me-up then undo, leave.

/*J034*/    if return_int = 0 then do:
/*J034*/       {mfmsg.i 725 3} /*USER DOES NOT HAVE ACCESS TO THIS SITE */
/*J034*/       next-prompt pq_site.
/*J034*/       undo, retry.
/*J034*/    end.

        /* ADD/MOD/DELETE  */
        del-yn = no.
        find first pq_mstr using pq_prod_line and pq_site
        and pq_rsc and pq_start no-error.

        if not available pq_mstr then do:
           {mfmsg.i 1 1}
           create pq_mstr.
           assign pq_prod_line pq_site pq_rsc pq_start.
        end.
        recno = recid(pq_mstr).

        ststatus = stline[2].
        status input ststatus.

        desc1 = "".
        find pl_mstr where pl_prod_line = pq_prod_line no-lock no-error.
        if available pl_mstr then desc1 = pl_desc.
        rsdesc = "".
        find rs_mstr where rs_rsc = pq_rsc and rs_site = pq_site
        no-lock no-error.
        if available rs_mstr then rsdesc = rs_desc.
        display desc1 rsdesc pq_end pq_qty pq_lead pq_lt_off.

/*G2LB*     set pq_end pq_qty pq_lead pq_lt_off editing: */
/*G2LB*/    update pq_end pq_qty pq_lead pq_lt_off editing:

           readkey.

           /* DELETE */
           if lastkey = keycode("F5")
           or lastkey = keycode("CTRL-D")
           then do:
          del-yn = yes.
          {mfmsg01.i 11 1 del-yn}
          if del-yn then leave.
           end.
           else apply lastkey.
        end.
        if del-yn then do:
           delete pq_mstr.
           clear frame a.
/*GUI*/ RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
        end.
     end.
/*GUI*/ if global-beam-me-up then undo, leave.

     status input.
